<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVoyagePlanTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('voyage_plan', function (Blueprint $table) {
            $table->increments('voyage_id');
            $table->string('ship_id')->default('')->comment('船舶编号');
            $table->string('departure_port')->default('')->comment('出发港');
            $table->string('destination_port')->default('')->comment('目的港');
            $table->decimal('planned_distance')->nullable()->comment('计划航程(海里)');
            $table->dateTime('estimated_departure')->nullable()->comment('预计离港时间');
            $table->dateTime('estimated_arrival')->nullable()->comment('预计到港时间');
            $table->json('waypoints')->nullable()->comment('转向点坐标(JSON格式)');
            $table->text('tide_data')->nullable()->comment('潮汐信息');
            $table->text('captain_instructions')->nullable()->comment('船长特别指示');
            $table->dateTime('create_time')->default('CURRENT_TIMESTAMP')->nullable()->comment('创建时间');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('voyage_plan');
    }
}
